$("header").load("header.html");
$("footer").load("footer.html");
//获取所有的商品类型接口
$.get('../php/getGoodsType.php', function (resText) {
    for (let i = 0; i < $(".modular-zi").length; i++) {
        $(".modular-zi").eq(i).click(function () {

            sessionStorage['typeId'] = resText[i].typeId;
            location.href = "details.html";
        })
    }
}, "json");
//获取商品列表接口
$.get('../php/getGoodsList.php', { "typeId": sessionStorage.typeId }, function (resText) {
    resText.forEach((v, i) => {
        $('.list').append(`
                <div class="btr-tw">
            <div class="btrtu">
                <img src="${v.goodsImg}" alt="">
            </div>
            <div class="btrname">
                ${v.goodsName}</div>
            <div class="btrfl">
                <button>赠</button>
                <button>积分抵<span>200</span>元</button>
                <button>满<span>700</span>减<span>10</span></button>
            </div>
            <div class="btnprice">
                <p>券后价<span>￥${v.goodsPrice}</span></p>
            </div>
        </div>
                `);
        for (let i = 0; i < $('.btr-tw').length; i++) {
            $('.btr-tw').eq(i).click(function () {
                location.href = "Productdetails.html"
            })
        }
    })
}, "json")